package com.yjt.fresh.bean;

import android.support.annotation.NonNull;

import com.yjt.fresh.service.Utils;

/**
 * 店铺
 * Created by mcc on 2018-07-16.
 */

public class BeanStore implements Comparable<BeanStore>{
    private String USERNAME;
    private String TRUENAME;
    private String PHONE;
    private String STATUS;
    private String CREATE_TIME;
    private String USER_ID;
    private String STORE_NAME;
    private String LOGO_IMG;
    private String ONE_TYPE;
    private String BOND;
    private String ENTER_FEE;
    private String TEL;
    private String PROVINCE;
    private String CITY;
    private String ADDRESS;
    private String LATITUDE_LONGITUDE;
    private String YU_MONEY;
    private String HUANXIN_ID;
    private String HUANXIN_PASSWORD;
    private String STORE_ID;
    private String CONTENT;

    private double localLongitude;
    private double localLatitude;

    public String getCONTENT() {
        return CONTENT;
    }

    public void setCONTENT(String CONTENT) {
        this.CONTENT = CONTENT;
    }

    public double getLocalLongitude() {
        return localLongitude;
    }

    public void setLocalLongitude(double localLongitude) {
        this.localLongitude = localLongitude;
    }

    public double getLocalLatitude() {
        return localLatitude;
    }

    public void setLocalLatitude(double localLatitude) {
        this.localLatitude = localLatitude;
    }

    public String getUSERNAME() {
        return USERNAME;
    }

    public void setUSERNAME(String USERNAME) {
        this.USERNAME = USERNAME;
    }

    public String getTRUENAME() {
        return TRUENAME;
    }

    public void setTRUENAME(String TRUENAME) {
        this.TRUENAME = TRUENAME;
    }

    public String getPHONE() {
        return PHONE;
    }

    public void setPHONE(String PHONE) {
        this.PHONE = PHONE;
    }

    public String getSTATUS() {
        return STATUS;
    }

    public void setSTATUS(String STATUS) {
        this.STATUS = STATUS;
    }

    public String getCREATE_TIME() {
        return CREATE_TIME;
    }

    public void setCREATE_TIME(String CREATE_TIME) {
        this.CREATE_TIME = CREATE_TIME;
    }

    public String getUSER_ID() {
        return USER_ID;
    }

    public void setUSER_ID(String USER_ID) {
        this.USER_ID = USER_ID;
    }

    public String getSTORE_NAME() {
        return STORE_NAME;
    }

    public void setSTORE_NAME(String STORE_NAME) {
        this.STORE_NAME = STORE_NAME;
    }

    public String getLOGO_IMG() {
        return LOGO_IMG;
    }

    public void setLOGO_IMG(String LOGO_IMG) {
        this.LOGO_IMG = LOGO_IMG;
    }

    public String getONE_TYPE() {
        return ONE_TYPE;
    }

    public void setONE_TYPE(String ONE_TYPE) {
        this.ONE_TYPE = ONE_TYPE;
    }

    public String getBOND() {
        return BOND;
    }

    public void setBOND(String BOND) {
        this.BOND = BOND;
    }

    public String getENTER_FEE() {
        return ENTER_FEE;
    }

    public void setENTER_FEE(String ENTER_FEE) {
        this.ENTER_FEE = ENTER_FEE;
    }

    public String getTEL() {
        return TEL;
    }

    public void setTEL(String TEL) {
        this.TEL = TEL;
    }

    public String getPROVINCE() {
        return PROVINCE;
    }

    public void setPROVINCE(String PROVINCE) {
        this.PROVINCE = PROVINCE;
    }

    public String getCITY() {
        return CITY;
    }

    public void setCITY(String CITY) {
        this.CITY = CITY;
    }

    public String getADDRESS() {
        return ADDRESS;
    }

    public void setADDRESS(String ADDRESS) {
        this.ADDRESS = ADDRESS;
    }

    public String getLATITUDE_LONGITUDE() {
        return LATITUDE_LONGITUDE;
    }

    public void setLATITUDE_LONGITUDE(String LATITUDE_LONGITUDE) {
        this.LATITUDE_LONGITUDE = LATITUDE_LONGITUDE;
    }

    public String getYU_MONEY() {
        return YU_MONEY;
    }

    public void setYU_MONEY(String YU_MONEY) {
        this.YU_MONEY = YU_MONEY;
    }

    public String getHUANXIN_ID() {
        return HUANXIN_ID;
    }

    public void setHUANXIN_ID(String HUANXIN_ID) {
        this.HUANXIN_ID = HUANXIN_ID;
    }

    public String getHUANXIN_PASSWORD() {
        return HUANXIN_PASSWORD;
    }

    public void setHUANXIN_PASSWORD(String HUANXIN_PASSWORD) {
        this.HUANXIN_PASSWORD = HUANXIN_PASSWORD;
    }

    public String getSTORE_ID() {
        return STORE_ID;
    }

    public void setSTORE_ID(String STORE_ID) {
        this.STORE_ID = STORE_ID;
    }

    @Override
    public int compareTo(@NonNull BeanStore beanStore) {
        String[] locations = LATITUDE_LONGITUDE.split(",");
        String[] otherLocations = beanStore.getLATITUDE_LONGITUDE().split(",");
        double distance = Utils.getDistance(Double.valueOf(locations[1]), Double.valueOf(locations[0]), localLongitude, localLatitude);
        double otherDistance = Utils.getDistance(Double.valueOf(otherLocations[1]), Double.valueOf(otherLocations[0]), beanStore.getLocalLongitude(), beanStore.getLocalLatitude());
        if (distance > otherDistance){
            return 1;
        }else if (distance < otherDistance){
            return -1;
        }else {
            return 0;
        }
    }
}
